package com.yxw.yx_hotel.controller;


import com.yxw.yx_hotel.dto.AddRoomPropertyDto;
import com.yxw.yx_hotel.dto.QueryRoomPropertyDto;
import com.yxw.yx_hotel.service.RoomPropertyService;
import com.yxw.yx_hotel.vo.RoomPropertyVo;
import com.yxw.yxnet_cd_center.common.dto.PageVO;
import com.yxw.yxnet_cd_center.common.utils.BaseResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import com.yxw.yx_hotel.entity.YxRoomPropertyEntity;
import java.util.List;
/**
 *  宿舍资产管理
 * @author liuxin
 * @date 2024.01.18
 */
@RestController
@Api(value = "宿舍资产管理", tags = "宿舍资产管理")
@Slf4j
@RequestMapping("/api/roomProperty")
public class RoomPropertyController {

    @Autowired
    private RoomPropertyService roomPropertyService;
    
    @ApiOperation(value = "新增宿舍资产")
    @PostMapping("/addRoomProperty")
    public BaseResult addRoomProperty(@Validated @RequestBody AddRoomPropertyDto dto)  {
        roomPropertyService.addRoomProperty(dto);
        return BaseResult.doSuccess(null,"新增成功");
    }

    @ApiOperation(value = "查询宿舍资产列表分页")
    @PostMapping("/pageRoomPropertyList")
    public BaseResult<PageVO<YxRoomPropertyEntity>> pageRoomList(@Validated @RequestBody QueryRoomPropertyDto dto)  {
        PageVO<YxRoomPropertyEntity> pageVo=roomPropertyService.pageRoomPropertyList(dto);
        return BaseResult.doSuccess(pageVo,"查询成功");
    }
    
    @ApiOperation(value = "查询宿舍资产列表不分页")
    @PostMapping("/roomPropertyList")
    public BaseResult<List<YxRoomPropertyEntity>> roomPropertyList(@Validated @RequestBody QueryRoomPropertyDto dto)  {
        List<YxRoomPropertyEntity> listVo = roomPropertyService.roomPropertyList(dto);
        return BaseResult.doSuccess(listVo,"查询成功");
    }
}
